#!/usr/bin/env python
# coding=utf-8
"""
# @Created on : 2016/04/23 16:27
# @Author     : ldf (ldf@eehello.com)
# @Link       : http://www.eehello.com
# @Version    : 
# 本程序在python2.7下测试通过
"""

'''
def run(kahao):
    print('还款')
'''
import pickle

def run(kahao):
    flag = 1
    while flag:
        with open('backgroud/ka_mon', 'rb') as fm:
            ka_mon_l = pickle.load(fm)
            ka_mon = ka_mon_l[kahao]
        print("您目前的额度为：%s , 退出，请按'q'" % ka_mon)
        huankuan = 15000 - ka_mon
        print('需还款: %d' % huankuan)
        huan = raw_input("请输入还款金额：")
        if huan == 'q':
            flag = 0

        if int(huankuan) != 0:
            ka_mon += int(huan)
            ka_mon_l[kahao] = ka_mon
            with open('backgroud/ka_mon', 'wb') as fw:
                pickle.dump(ka_mon_l, fw)
        else:
            print('您没有欠款')
